/**
 * @description 字符串替换 "abc{YYYY_MM_DD}" => "abc2020_12_11"
 * @param {string} inputStr 字符串
 */
import moment from 'moment';
export default function formatStrParse(inputStr) {
    let dateStr = inputStr.match(/\{.+\}/g);
    if (Array.isArray(dateStr) && dateStr.length > 0) {
        dateStr.forEach(item => {
            const str = item.replace(/[{|}]/g, '');
            inputStr = inputStr.replace(/\{.+\}/g, moment().format(str));
        });
    }
    return inputStr || '';
}
